﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using Maticsoft.Common;
using LTP.Accounts.Bus;
namespace MidSoft.Web.Model_T_PET_COMPLAIN
{
    public partial class Add : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
                       
        }

        		protected void btnSave_Click(object sender, EventArgs e)
		{
			
			string strErr="";
			if(this.txtPET_COMPLAIN_ID.Text.Trim().Length==0)
			{
				strErr+="ID不能为空！\\n";	
			}
			if(this.txtAFTER_RESULT.Text.Trim().Length==0)
			{
				strErr+="后期结果不能为空！\\n";	
			}
			if(!PageValidate.IsDateTime(txtCOMP_DATE.Text))
			{
				strErr+="投诉日期格式错误！\\n";	
			}
			if(this.txtCOMP_SOURCE.Text.Trim().Length==0)
			{
				strErr+="投诉来源不能为空！\\n";	
			}
			if(this.txtCONTENT.Text.Trim().Length==0)
			{
				strErr+="内容不能为空！\\n";	
			}
			if(this.txtKICKER_ADDRESS.Text.Trim().Length==0)
			{
				strErr+="投诉人地址不能为空！\\n";	
			}
			if(this.txtCOMP_USER_NAME.Text.Trim().Length==0)
			{
				strErr+="姓名不能为空！\\n";	
			}
			if(this.txtKICKER_PHONE.Text.Trim().Length==0)
			{
				strErr+="电话不能为空！\\n";	
			}
			if(this.txtLEADER_OPINION.Text.Trim().Length==0)
			{
				strErr+="领导意见不能为空！\\n";	
			}
			if(this.txtNOTE.Text.Trim().Length==0)
			{
				strErr+="备注。不能为空！\\n";	
			}
			if(this.txtOBJECT_ID.Text.Trim().Length==0)
			{
				strErr+="对象ID。不能为空！\\n";	
			}
			if(!PageValidate.IsDecimal(txtOBJECT_TYPE.Text))
			{
				strErr+="对象类型。格式错误！\\n";	
			}
			if(this.txtREG_ORG_ID.Text.Trim().Length==0)
			{
				strErr+="注册机构ID。不能为空！\\n";	
			}
			if(this.txtRESULT1.Text.Trim().Length==0)
			{
				strErr+="结果1。不能为空！\\n";	
			}
			if(this.txtRESULT2.Text.Trim().Length==0)
			{
				strErr+="结果2。不能为空！\\n";	
			}
			if(this.txtRESULT3.Text.Trim().Length==0)
			{
				strErr+="结果3。不能为空！\\n";	
			}
			if(this.txtSERIAL_NUM.Text.Trim().Length==0)
			{
				strErr+="续号。不能为空！\\n";	
			}
			if(!PageValidate.IsDecimal(txtSTATE.Text))
			{
				strErr+="状态。格式错误！\\n";	
			}
			if(this.txtTAKER_NAME.Text.Trim().Length==0)
			{
				strErr+="接收人。不能为空！\\n";	
			}
			if(this.txtTAKER_OPINION.Text.Trim().Length==0)
			{
				strErr+="接收人意见。不能为空！\\n";	
			}
			if(!PageValidate.IsDecimal(txtTYPE.Text))
			{
				strErr+="类型。格式错误！\\n";	
			}
			if(!PageValidate.IsDateTime(txtCREATE_TIME.Text))
			{
				strErr+="创建时间。格式错误！\\n";	
			}
			if(this.txtCREATOR_ID.Text.Trim().Length==0)
			{
				strErr+="创建ID。不能为空！\\n";	
			}
			if(!PageValidate.IsDateTime(txtUPDATE_TIME.Text))
			{
				strErr+="更新时间。格式错误！\\n";	
			}
			if(this.txtUPDATOR_ID.Text.Trim().Length==0)
			{
				strErr+="更新ID。不能为空！\\n";	
			}
			if(!PageValidate.IsDateTime(txtTAKE_TIME.Text))
			{
				strErr+="接收时间。格式错误！\\n";	
			}
			if(!PageValidate.IsDecimal(txtID.Text))
			{
				strErr+="原ID格式错误！\\n";	
			}

			if(strErr!="")
			{
				MessageBox.Show(this,strErr);
				return;
			}
			string PET_COMPLAIN_ID=this.txtPET_COMPLAIN_ID.Text;
			string AFTER_RESULT=this.txtAFTER_RESULT.Text;
			DateTime COMP_DATE=DateTime.Parse(this.txtCOMP_DATE.Text);
			string COMP_SOURCE=this.txtCOMP_SOURCE.Text;
			string CONTENT=this.txtCONTENT.Text;
			string KICKER_ADDRESS=this.txtKICKER_ADDRESS.Text;
			string COMP_USER_NAME=this.txtCOMP_USER_NAME.Text;
			string KICKER_PHONE=this.txtKICKER_PHONE.Text;
			string LEADER_OPINION=this.txtLEADER_OPINION.Text;
			string NOTE=this.txtNOTE.Text;
			string OBJECT_ID=this.txtOBJECT_ID.Text;
			decimal OBJECT_TYPE=decimal.Parse(this.txtOBJECT_TYPE.Text);
			string REG_ORG_ID=this.txtREG_ORG_ID.Text;
			string RESULT1=this.txtRESULT1.Text;
			string RESULT2=this.txtRESULT2.Text;
			string RESULT3=this.txtRESULT3.Text;
			string SERIAL_NUM=this.txtSERIAL_NUM.Text;
			decimal STATE=decimal.Parse(this.txtSTATE.Text);
			string TAKER_NAME=this.txtTAKER_NAME.Text;
			string TAKER_OPINION=this.txtTAKER_OPINION.Text;
			decimal TYPE=decimal.Parse(this.txtTYPE.Text);
			DateTime CREATE_TIME=DateTime.Parse(this.txtCREATE_TIME.Text);
			string CREATOR_ID=this.txtCREATOR_ID.Text;
			DateTime UPDATE_TIME=DateTime.Parse(this.txtUPDATE_TIME.Text);
			string UPDATOR_ID=this.txtUPDATOR_ID.Text;
			DateTime TAKE_TIME=DateTime.Parse(this.txtTAKE_TIME.Text);
			decimal ID=decimal.Parse(this.txtID.Text);

			MidSoft.Model.Model_T_PET_COMPLAIN model=new MidSoft.Model.Model_T_PET_COMPLAIN();
			model.PET_COMPLAIN_ID=PET_COMPLAIN_ID;
			model.AFTER_RESULT=AFTER_RESULT;
			model.COMP_DATE=COMP_DATE;
			model.COMP_SOURCE=COMP_SOURCE;
			model.CONTENT=CONTENT;
			model.KICKER_ADDRESS=KICKER_ADDRESS;
			model.COMP_USER_NAME=COMP_USER_NAME;
			model.KICKER_PHONE=KICKER_PHONE;
			model.LEADER_OPINION=LEADER_OPINION;
			model.NOTE=NOTE;
			model.OBJECT_ID=OBJECT_ID;
			model.OBJECT_TYPE=OBJECT_TYPE;
			model.REG_ORG_ID=REG_ORG_ID;
			model.RESULT1=RESULT1;
			model.RESULT2=RESULT2;
			model.RESULT3=RESULT3;
			model.SERIAL_NUM=SERIAL_NUM;
			model.STATE=STATE;
			model.TAKER_NAME=TAKER_NAME;
			model.TAKER_OPINION=TAKER_OPINION;
			model.TYPE=TYPE;
			model.CREATE_TIME=CREATE_TIME;
			model.CREATOR_ID=CREATOR_ID;
			model.UPDATE_TIME=UPDATE_TIME;
			model.UPDATOR_ID=UPDATOR_ID;
			model.TAKE_TIME=TAKE_TIME;
			model.ID=ID;

			MidSoft.BLL.BLL_T_PET_COMPLAIN bll=new MidSoft.BLL.BLL_T_PET_COMPLAIN();
			bll.Add(model);
			Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功！","add.aspx");

		}


        public void btnCancle_Click(object sender, EventArgs e)
        {
            Response.Redirect("list.aspx");
        }
    }
}
